/*
 * ElseBlockInstruction.h
 *
 *  Created on: 30/dic/2010
 *      Author: computer
 */

#ifndef ELSEBLOCKINSTRUCTION_H_
#define ELSEBLOCKINSTRUCTION_H_
#include "Expression.h"
#include "FlowExpression.h"
#include "IfInstruction.h"

namespace TreeExpression {

class ElseBlockInstruction : public FlowExpression, public Expression_CRTP<ElseBlockInstruction> {
public:
	ElseBlockInstruction();
	ElseBlockInstruction(const ElseBlockInstruction&);
	virtual ~ElseBlockInstruction();

	Expression* clone() const;
	virtual bool isStop() const;

	virtual AutoPointer<Expression> eval(CopyPointer<Context>&);
	virtual std::string toString() const;

	void addElseBlock(const AutoPointer<Expression>&);
	void setEndElseBlock(const AutoPointer<Expression>&);
private:
	bool stop;
	AutoPointer<Expression> endElseBlock;
	std::list< AutoPointer<Expression> > listElseBlock;
};

}

#endif /* ELSEBLOCKINSTRUCTION_H_ */
